define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'superdata/actrelusr/index' + location.search,
                    // add_url: 'superdata/actrelusr/add',
                    // edit_url: 'superdata/actrelusr/edit',
                    // del_url: 'superdata/actrelusr/del',
                    // multi_url: 'superdata/actrelusr/multi',
                    // import_url: 'superdata/actrelusr/import',
                    table: 'activity_participants',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                columns: [
                    [
                        // {checkbox: true},
                        {field:'no',title:__('序号'),operate:false,
                            formatter:function(value,row,index){
                                var pageSize=table.bootstrapTable('getOptions').pageSize;//获取每页显示的数量
                                var pageNumber=table.bootstrapTable('getOptions').pageNumber;//获取当前是第几面
                                return pageSize * (pageNumber - 1) + index +1 ;
                            }
                        },
                        {field: 'account.username', title: __('Account.username'), operate: 'LIKE'},
                        {field: 'account.mobile', title: __('Account.mobile')},
                        {field: 'account.activity_count', title: __('Activity_count'),operate:false},
                        {field: 'account.series_count', title: __('Series_count'),operate:false},
                        {field: 'account.total_pay', title: __('Total_pay'),operate:false},
                        {field: 'account.order_count', title: __('Order_count'),operate:false},
                        {field: 'account.collection_count', title: __('Collection_count'),operate:false},
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});